﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WFL.Data
{
    [AttributeUsage(AttributeTargets.Property
        , AllowMultiple = false
        , Inherited = true)]
    public class ForeignKeyAttribute : DefinitionAttribute
    {
        public Type ReferenceType
        {
            get;
            private set;
        }

        public string ReferencePropertyName
        {
            get;
            private set;
        }

        public ForeignKeyAttribute(Type referenceType, string referencePropertyName)
        {
            if (referenceType == null)
            {
                throw new ArgumentNullException("referenceType");
            }
            ReferenceType = referenceType;
            ReferencePropertyName = referencePropertyName;
        }

        public ForeignKeyAttribute(Type referenceType) : this(referenceType, null)
        {

        }
    }
}
